*******************
* Exporting representativeness table for Global South COVID paper
* 2020-09-22
* last updated: 2020-10-20
* Elliott
*******************

set more off
use "$da/COL_reptable.dta" , clear

gl weight LSMS_WEIGHT
local demographics rural hhsize female finishedsecondary PPI

* Make Table

    gen var   = ""
    gen mean  = .
    gen wmean = .
    order var mean wmean
    global counter=1
    foreach v of varlist `demographics' {
        disp `v'
        replace var="`v'" in $counter
        qui sum `v'
        replace mean = `r(mean)' in $counter
        qui sum `v' [aw=$weight]
        replace wmean = `r(mean)' in $counter
        global counter=$counter + 1
    }
    keep if var != ""
    keep mean wmean
    format mean wmean %10.2fc

    export excel using "$dtab/Representativeness Table.xlsx", sheetmodify cell(C45)

/*
RWA 92
PHP 85
COL 45
BFA 38

*/
